package com.neuedu.controller;


import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

@Controller
//@RestController
public class JspController {

    /**
     * http://127.0.0.1:8080/toview
     * @return
     */
    @GetMapping("toview")
    String toview(){
        return "/index.jsp";
    }


    @GetMapping("business")
    String business(){
        int result = 0/0;
        return "/index.jsp";
    }


    @ExceptionHandler(value = Exception.class )
    @ResponseBody
    String resolveException(HttpServletRequest request, HttpServletResponse response, Exception ex  ){

        System.out.println(ex.getMessage());
        return "{status:'unup',msg:'出错了'}";
    }






}
